package com.zhz.company.repository.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.zhz.common.tool.mybatisplus.base.dal.entity.BasePO;
import com.zhz.common.tool.mybatisplus.base.dal.repository.impl.BaseRepositoryImpl;
import com.zhz.company.repository.dao.DepartmentDao;
import com.zhz.company.repository.service.DepartmentService;
import com.zhz.model.company.Department;
import com.zhz.model.company.contract.dto.DepartmentDTO;
import com.zhz.model.company.contract.param.DepartmentQueryParam;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;

/**
 * @author zhouhengzhe
 * @date 2023/3/22
 */
@Service
public class DepartmentServiceImpl extends BaseRepositoryImpl<DepartmentDao, DepartmentDTO, Department, DepartmentQueryParam> implements DepartmentService {
    @Override
    protected QueryWrapper<Department> getWrapper(DepartmentQueryParam queryParam) {
        return getDefaultWrapper()
                .eq(StringUtils.isNotBlank(queryParam.getId()), BasePO.ID, queryParam.getId())
                .eq(StringUtils.isNotBlank(queryParam.getCompanyId()), Department.COMPANY_ID, queryParam.getCompanyId());
    }
}
